Command Palette: Make admin bar trigger a native group element#11171
Command Palette: Make admin bar trigger a native group element#11171ellatrix wants to merge 3 commits intoWordPress:trunkfrom
Conversation
Instead of adding the command palette as a regular node in root-default, register it as its own group under root. This makes it a sibling `<ul>` to root-default and top-secondary, allowing flexbox centering on `.quicklinks` without being constrained to the `<li>` node structure. - Add `command-palette` as a group with `add_group()`, place the trigger node inside it as `command-palette-trigger` - Convert `.quicklinks` to `display: flex` for layout control - Both side groups use `flex: 1 1 0; min-width: fit-content` so they share equal space but never shrink their content - Command palette group uses `flex: 0 0 auto` to sit centered between them naturally Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
|
So the command palette is not accessible on mobile. Why shouldn't it be? |
|
It's the same as #11108, I don't think I changed anything there. I guess it will have to be added explicitly to the mobile version of the admin bar |
t-hamano
left a comment
There was a problem hiding this comment.
Thanks for the PR! When I actually saw the center-aligned search bar, I realized it was quite prominent 😅
There are two things that concern me.
- With several plugins installed, the search bar may become misaligned:

- When I open the editor, you may find the search bar overlapping, which can be a bit confusing:

Personally, I think going with #11160 might have the least impact. What do you think? cc @sabernhardt
I think that's fine, it still looks ok?
What o you mean here? What overlaps what?
Would need approval from design |
|
Something that looks like an input/search field but isn't one feels wrong.
They're not overlapping, but there are two of these bars right next to each other. |
Two approaches have been proposed that do not use a search bar in the first place. |
|
Let's land this ahead of the next beta so we can get more testing. Previously, the smaller command‑K control would have worked to get an initial version in to a prior beta but, at this point, it's important we stick with the design and project leadership direction. |
mcsf
left a comment
There was a problem hiding this comment.
Nice. Let's go with this and see if it needs any polishing before 7.0.
| } | ||
|
|
||
| #wpadminbar #wp-admin-bar-command-palette-trigger .ab-icon { | ||
| transform: scaleX(-1); |
There was a problem hiding this comment.
What again about the mobile viewport? Having the admin bar expose an item to access the command palette on mobile is arguably even more important since the keyboard is not normally displayed when an input isn't focused. I like the approach in @sabernhardt's PR: #11160
sabernhardt
left a comment
There was a problem hiding this comment.
I made #11160, hoping to avoid picking this one apart.
Something that looks like an input/search field but isn't one feels wrong.
It's the same for the editor document bar 🙂
The proposed toolbar link is not the same. The document bar element in the editor canvas does not have a search icon or empty space between the icon and the keyboard shortcut text. Anyone who sees something that looks like this should expect it to be an input field (or maybe the overlay could cover it, with similar styling, as in Slack).
| } | ||
|
|
||
| #wpadminbar .quicklinks { | ||
| display: flex; |
There was a problem hiding this comment.
Introducing flex—without wrap—in core intensifies an existing problem for sites with crowded toolbars. That can push the profile links and/or others off the screen, making it impossible to reach the Log Out link (unless you use the keyboard to navigate). Then adding an element that is 215 pixels wide would break more sites, and in a worse way.
Profile menu off-screen at 1,000 pixels wide, with a few plugins activated:
Profile menu expanded with the Enter key:
There was a problem hiding this comment.
Trying something where if it doesn't fit, we fall back to normal toolbar behavior.
shrink.mov
|
|
||
| #wpadminbar #wp-admin-bar-command-palette-trigger .ab-item { | ||
| width: 200px; | ||
| background: #757575; |
There was a problem hiding this comment.
#757575 does not give enough contrast behind the #f0f0f1 text in the Fresh scheme (4.05:1).
The hover and focus states typically have less contrast.
Low contrast for Modern (default) scheme on hover/focus:
3.47:1 #7b90ff against #3c434a
Very low contrast for Fresh on hover/focus:
1.96:1 #72aee6 against #757575
There was a problem hiding this comment.
Yes, this needs to be changed to a variable
There was a problem hiding this comment.
Actually sorry, I guess it needs an override for that color scheme
|
|
||
| .wp-responsive-open div#wp-responsive-toggle a { | ||
| // ToDo: make inset border | ||
| // ToDo: make inset border; |
There was a problem hiding this comment.
Unrelated change.
I do not even find a #wp-responsive-toggle anywhere, even in code history as of r26402, so the two rulesets probably can be removed entirely (later).
There was a problem hiding this comment.
I just built on top of Aki's PR, I can remove it https://github.com/WordPress/wordpress-develop/pull/11108/changes#diff-4e38d3d83e223f96e67e1cf68c5b2faa0abbd3c068a2405cf0e712dd8edcf8e9R669
|
This looks good. Please land this so we have time to test sooner rather than later. |

Trac: https://core.trac.wordpress.org/ticket/64672
Screen.Recording.2026-03-05.at.09.53.12.mov
Summary
Follow-up to #11108. Makes the command palette trigger a native admin bar group element instead of a regular node in
root-default, as suggested in review.command-paletteas its own group underrootusingadd_group(), with the trigger node inside it — this produces a sibling<ul>toroot-defaultandtop-secondary.quicklinkstodisplay: flexso the three groups lay out naturally: left items, centered command palette, right itemsflex: 1 1 0; min-width: fit-content— equal space when the viewport is wide (perfect centering), but they won't shrink below their content on narrow viewportsflex: 0 0 autobetween themExisting float declarations on
<li>elements become harmless (floats are ignored on flex items per CSS spec).Alternative approach
An alternative would be to bypass the node/group API entirely and render the command palette directly in
WP_Admin_Bar::_render()as a standalone<button>element — a sibling to the<ul>groups inside.quicklinks. This would give full control over the markup (semantic<button>instead of<a>inside<li>inside<ul>), but requires modifyingclass-wp-admin-bar.phpand hardcoding the element into the admin bar's render method. The group-based approach here is more straightforward since it reuses the existing API and keeps all the command palette logic inadmin-bar.php.Test plan
🤖 Generated with Claude Code